package tools;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * Title:
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:
 * @author
 * @version 1.0
 */

public class XslProcess extends TextProcess {

  /**
   * This filter works with the file chooser to limit the files shown.<p>
   */
  private javax.swing.filechooser.FileFilter xslFilter =
                           new javax.swing.filechooser.FileFilter(){
    public boolean accept( java.io.File pathname ){
      return pathname.isDirectory() || pathname.getName().endsWith( ".xsl" );
    }

    public String getDescription(){
      return "eXtensible Stylesheet Language (*.xsl)";
    }
  };

  public XslProcess() {
    super();
    addChoosableFileFilter( xslFilter );
    setName( "XSL" );

    JPanel southPanel = new JPanel( new FlowLayout( FlowLayout.CENTER ) );
    JPanel buttonPanel = new JPanel( new GridLayout() );
    southPanel.add( buttonPanel );
    JButton generateXmlButton = new JButton( "Generate XML" );

    generateXmlButton.addActionListener( new ActionListener(){
      public void actionPerformed( ActionEvent e ){
        generateXmlPerformed( e );
      }
    } );

    buttonPanel.add( generateXmlButton );

    add( southPanel, BorderLayout.SOUTH );
  }

  protected void generateXmlPerformed( ActionEvent e ){
    fireActionPerformed( new ActionEvent( this, e.ACTION_PERFORMED,
                                            e.getActionCommand() ) );
  }
}